package com.wmh.baseservice.user.enums;

public enum FileTypeEnum {
    AVATAR("avatar", "user_avatar/"),
    GOODS_IMG("goodsImg", "goods_img/"),
    MAIN_IMG("mainImg", "main_img/"),
    PICKUP_POINT_IMG("pickupPointImg", "pickup_point_img/"),
    ROTATING_CHART("rotatingChart", "rotating_chart/"),
    VIDEO("video", "video/"),
    QR_CODE("qrCodes", "qr_codes/"),
    UNKNOWN("unknown", "unknown");

    private final String type;
    private final String key;

    FileTypeEnum(String type, String key) {
        this.type = type;
        this.key = key;
    }

    public String getKey() {
        return key;
    }

    public static FileTypeEnum fromString(String type) {
        for (FileTypeEnum fileType : FileTypeEnum.values()) {
            if (fileType.type.equalsIgnoreCase(type)) {
                return fileType;
            }
        }
        return UNKNOWN;
    }
}
